﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;


namespace HanGu.Common
{
    public class Helper
    {
       
        /// <summary>
        /// 缩略图宽度
        /// </summary>
        public static readonly int PhotoWidth = 200;
        /// <summary>
        /// 缩略图高度
        /// </summary>
        public static readonly int PhotoHeight = 200;

        /// <summary>
        /// 指定 缩略图裁剪模式 CUT（指定宽高）,W（指定宽度，高自动）,H(指定高度，宽自动)
        /// </summary>
        public static readonly string PhotoCutMode = "CUT";

        /// <summary>
        /// 指定列表页 每页显示条数
        /// </summary>
        public static readonly int PageSize = 50;

        public static string MD5(string str)
        {
            return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
            //MD5 md5 = new MD5CryptoServiceProvider();
            //byte[] result = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(str));
            //return System.Text.Encoding.Default.GetString(result);

        }

        public static string GetGuid
        {
            get { return Guid.NewGuid().ToString("N"); }

        }

        public const string DATETIME = "yyyy-MM-dd";

        public static string FormatDate(object dateTime)
        {
            if (dateTime == null) return string.Empty; ;
            DateTime _datetime = DateTime.Now;
            DateTime.TryParse(dateTime.ToString(), out _datetime);
            return _datetime.ToString(DATETIME);
        }

        public const string DEFAULTPWD = "88888888";

        public static List<string> SuperUsers
        {
            get
            {
                List<string> superUsers = new List<string>();
                superUsers.Add("luochengbang");
                superUsers.Add("admin");
                superUsers.Add("administrator");
                superUsers.Add("root");
                superUsers.Add("super");
                return superUsers;
            }
        }

    }
}
